// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// This file is part of CodingEditor.
// Note:	This project is derived from Peter Project
//			(hosted on sourceforge and codeplex)
//
// Copyright (c) 2008-2009, CE Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


namespace CE.Main
{
	using System;
	using System.Windows.Forms;

	#region Enumerations

	public enum ProjectType
	{
		CPlusPlus, CSharp
	}

	#endregion Enumerations

	public sealed partial class NewProject : CEBaseForm
	{
		#region Constructors

		public NewProject()
		{
			InitializeComponent();

			cmbProjectType.Items.Add("C++ Project");
			cmbProjectType.Items.Add("C# Project");
			cmbProjectType.SelectedIndex = 0;
            this.Location = MousePosition;
		}

		#endregion Constructors

		#region Methods

		private void CreateProject()
		{
			Program.ShowMessage("Still not implemented");
		}

		private void EnableBtnOK()
		{
			btnOK.Enabled = (txtProjectLocation.TextLength > 0 && txtProjectName.TextLength > 0);
		}

		private void ShowFolderDialog()
		{
			FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
			folderBrowserDialog.Description = "Select Project Location:";
			if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
				if (folderBrowserDialog.SelectedPath != null) {
					txtProjectLocation.Text = folderBrowserDialog.SelectedPath;
				}
			}
		}

		private void btnBrowse_Click(object sender, EventArgs e)
		{
			ShowFolderDialog();
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			CreateProject();
		}

		private void txtProjectLocation_KeyDown(object sender, KeyEventArgs e)
		{
			ShowFolderDialog();
		}

		private void txtProjectLocation_TextChanged(object sender, EventArgs e)
		{
			EnableBtnOK();
		}

		private void txtProjectName_TextChanged(object sender, EventArgs e)
		{
			EnableBtnOK();
		}

        private void NewProject_Paint(object sender, PaintEventArgs e)
        {
            Program.MakeBackgroundGradient(e.Graphics, this);
        }

		#endregion Methods
	}
}